<?php 
session_start();
include 'connect.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<link rel="stylesheet" type="text/css" href="styles.css"/>
<link rel="stylesheet" type="text/css" href="forms.css">
</head>
<body>
<div class="logo"></div> 
<div id="container">
<div id="MainContent">
<div id="user">
<?php
			
			if (isset($_SESSION['MemberID'])){
					echo "Hi, ".$_SESSION['Username'].".<br />";
				}
				?>

<?php if (isset($_SESSION['MemberID'])){ echo "<a href='logout.php'>Logout</a>";}?>
</div>

<?php 
if (isset($_SESSION['MemberID'])){
				$query = "SELECT DISTINCT p.ProjectName, p.Description, p.Status FROM members m, project p WHERE ".$_SESSION['MemberID']."=p.CreatorID";
				$result = mysql_query($query);
				if (!$result) {
				    $message  = 'Invalid query: ' . mysql_error() . "\n";
				    $message .= 'Whole query: ' . $query;
				    die($message);
				}
				$row = mysql_fetch_array($result);
}
else echo "Please <a href='index.php'>login</a> to access this page.";
?>
<div class="clear"></div>

<form method="post" action="">
 <fieldset>
   <legend class="title">Update the Project</legend>

	  <p>
     <label for="Name">Project Name</label> <em>*</em><br />
    <input type = "text" id="Name" name="Name" size="25" value="<?php echo $row["ProjectName"]; ?>" class="required" minlength="2" />
   </p>
   <p>
   <label for = "status">Status: </label><br />
	<input type = "text" name="status" value="<?php echo $row['Status']?>"/>
   </p>
   <p>
     <label for="Name">Description</label> <em>*</em><br />
    <textarea class="required" minlength="2" ><?php echo $row["Description"]; ?></textarea>
   </p>
   
   <p>
<input type="submit" value="Update" name="Update"/>
<input type="submit" value="Delete" name="Delete"/>
<a href="memberProjects.php">Cancel</a>
   </p>
 </fieldset>
 </form>
</div>
</div>
</body>
</html>